home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / perl5000.zip / perl5000 / perly.c.diff < prev    next >
Text File  |  1994-09-15  |  11KB  |  421 lines

  1. *** perly.c.orig    Thu Sep 15 11:18:35 1994
  2. --- perly.c    Thu Sep 15 11:19:31 1994
  3. ***************
  4. *** 12,79 ****
  5.       deprecate("\"do\" to call subroutines");
  6.   }
  7.   
  8. - #line 30 "perly.y"
  9. - typedef union {
  10. -     I32    ival;
  11. -     char *pval;
  12. -     OP *opval;
  13. -     GV *gvval;
  14. - } YYSTYPE;
  15. - #line 23 "y.tab.c"
  16. - #define WORD 257
  17. - #define METHOD 258
  18. - #define FUNCMETH 259
  19. - #define THING 260
  20. - #define PMFUNC 261
  21. - #define PRIVATEREF 262
  22. - #define LABEL 263
  23. - #define FORMAT 264
  24. - #define SUB 265
  25. - #define ANONSUB 266
  26. - #define PACKAGE 267
  27. - #define USE 268
  28. - #define WHILE 269
  29. - #define UNTIL 270
  30. - #define IF 271
  31. - #define UNLESS 272
  32. - #define ELSE 273
  33. - #define ELSIF 274
  34. - #define CONTINUE 275
  35. - #define FOR 276
  36. - #define LOOPEX 277
  37. - #define DOTDOT 278
  38. - #define FUNC0 279
  39. - #define FUNC1 280
  40. - #define FUNC 281
  41. - #define RELOP 282
  42. - #define EQOP 283
  43. - #define MULOP 284
  44. - #define ADDOP 285
  45. - #define DOLSHARP 286
  46. - #define DO 287
  47. - #define LOCAL 288
  48. - #define HASHBRACK 289
  49. - #define NOAMP 290
  50. - #define OROP 291
  51. - #define ANDOP 292
  52. - #define NOTOP 293
  53. - #define LSTOP 294
  54. - #define ASSIGNOP 295
  55. - #define OROR 296
  56. - #define ANDAND 297
  57. - #define BITOROP 298
  58. - #define BITANDOP 299
  59. - #define UNIOP 300
  60. - #define SHIFTOP 301
  61. - #define MATCHOP 302
  62. - #define UMINUS 303
  63. - #define REFGEN 304
  64. - #define POWOP 305
  65. - #define PREINC 306
  66. - #define PREDEC 307
  67. - #define POSTINC 308
  68. - #define POSTDEC 309
  69. - #define ARROW 310
  70.   #define YYERRCODE 256
  71.   short yylhs[] = {                                        -1,
  72.      30,    0,    5,    3,    6,    6,    6,    7,    7,    7,
  73. --- 12,17 ----
  74. ***************
  75. *** 1334,1346 ****
  76.   int yynerrs;
  77.   int yyerrflag;
  78.   int yychar;
  79. - short *yyssp;
  80. - YYSTYPE *yyvsp;
  81.   YYSTYPE yyval;
  82.   YYSTYPE yylval;
  83. - short yyss[YYSTACKSIZE];
  84. - YYSTYPE yyvs[YYSTACKSIZE];
  85. - #define yystacksize YYSTACKSIZE
  86.   #line 544 "perly.y"
  87.    /* PROGRAM */
  88.   #line 1347 "y.tab.c"
  89. --- 1272,1279 ----
  90. ***************
  91. *** 1347,1360 ****
  92. --- 1280,1338 ----
  93.   #define YYABORT goto yyabort
  94.   #define YYACCEPT goto yyaccept
  95.   #define YYERROR goto yyerrlab
  96. + struct ysv {
  97. +     short* yyss;
  98. +     YYSTYPE* yyvs;
  99. +     int oldyydebug;
  100. +     int oldyynerrs;
  101. +     int oldyyerrflag;
  102. +     int oldyychar;
  103. +     YYSTYPE oldyyval;
  104. +     YYSTYPE oldyylval;
  105. + };
  106. + void
  107. + yydestruct(ptr)
  108. + void* ptr;
  109. + {
  110. +     struct ysv* ysave = (struct ysv*)ptr;
  111. +     if (ysave->yyss) Safefree(ysave->yyss);
  112. +     if (ysave->yyvs) Safefree(ysave->yyvs);
  113. +     yydebug    = ysave->oldyydebug;
  114. +     yynerrs    = ysave->oldyynerrs;
  115. +     yyerrflag    = ysave->oldyyerrflag;
  116. +     yychar    = ysave->oldyychar;
  117. +     yyval    = ysave->oldyyval;
  118. +     yylval    = ysave->oldyylval;
  119. +     Safefree(ysave);
  120. + }
  121.   int
  122.   yyparse()
  123.   {
  124.       register int yym, yyn, yystate;
  125. +     register short *yyssp;
  126. +     register YYSTYPE *yyvsp;
  127. +     short* yyss;
  128. +     YYSTYPE* yyvs;
  129. +     unsigned yystacksize = YYSTACKSIZE;
  130. +     int retval = 0;
  131.   #if YYDEBUG
  132.       register char *yys;
  133.       extern char *getenv();
  134. + #endif
  135.   
  136. +     struct ysv *ysave = (struct ysv*)safemalloc(sizeof(struct ysv));
  137. +     SAVEDESTRUCTOR(yydestruct, ysave);
  138. +     ysave->oldyydebug    = yydebug;
  139. +     ysave->oldyynerrs    = yynerrs;
  140. +     ysave->oldyyerrflag    = yyerrflag;
  141. +     ysave->oldyychar    = yychar;
  142. +     ysave->oldyyval    = yyval;
  143. +     ysave->oldyylval    = yylval;
  144. + #if YYDEBUG
  145.       if (yys = getenv("YYDEBUG"))
  146.       {
  147.           yyn = *yys;
  148. ***************
  149. *** 1367,1372 ****
  150. --- 1345,1358 ----
  151.       yyerrflag = 0;
  152.       yychar = (-1);
  153.   
  154. +     /*
  155. +     ** Initialize private stacks (yyparse may be called from an action)
  156. +     */
  157. +     ysave->yyss = yyss = (short*)safemalloc(yystacksize*sizeof(short));
  158. +     ysave->yyvs = yyvs = (YYSTYPE*)safemalloc(yystacksize*sizeof(YYSTYPE));
  159. +     if (!yyvs || !yyss)
  160. +     goto yyoverflow;
  161.       yyssp = yyss;
  162.       yyvsp = yyvs;
  163.       *yyssp = yystate = 0;
  164. ***************
  165. *** 1382,1388 ****
  166.               yys = 0;
  167.               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  168.               if (!yys) yys = "illegal-symbol";
  169. !             printf("yydebug: state %d, reading %d (%s)\n", yystate,
  170.                       yychar, yys);
  171.           }
  172.   #endif
  173. --- 1368,1374 ----
  174.               yys = 0;
  175.               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  176.               if (!yys) yys = "illegal-symbol";
  177. !             fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate,
  178.                       yychar, yys);
  179.           }
  180.   #endif
  181. ***************
  182. *** 1392,1403 ****
  183.       {
  184.   #if YYDEBUG
  185.           if (yydebug)
  186. !             printf("yydebug: state %d, shifting to state %d\n",
  187.                       yystate, yytable[yyn]);
  188.   #endif
  189.           if (yyssp >= yyss + yystacksize - 1)
  190.           {
  191. !             goto yyoverflow;
  192.           }
  193.           *++yyssp = yystate = yytable[yyn];
  194.           *++yyvsp = yylval;
  195. --- 1378,1403 ----
  196.       {
  197.   #if YYDEBUG
  198.           if (yydebug)
  199. !             fprintf(stderr, "yydebug: state %d, shifting to state %d\n",
  200.                       yystate, yytable[yyn]);
  201.   #endif
  202.           if (yyssp >= yyss + yystacksize - 1)
  203.           {
  204. !         /*
  205. !         ** reallocate and recover.  Note that pointers
  206. !         ** have to be reset, or bad things will happen
  207. !         */
  208. !         int yyps_index = (yyssp - yyss);
  209. !         int yypv_index = (yyvsp - yyvs);
  210. !         yystacksize += YYSTACKSIZE;
  211. !         ysave->yyvs = yyvs =
  212. !         (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
  213. !         ysave->yyss = yyss =
  214. !         (short*)realloc((char*)yyss,yystacksize * sizeof(short));
  215. !         if (!yyvs || !yyss)
  216. !         goto yyoverflow;
  217. !         yyssp = yyss + yyps_index;
  218. !         yyvsp = yyvs + yypv_index;
  219.           }
  220.           *++yyssp = yystate = yytable[yyn];
  221.           *++yyvsp = yylval;
  222. ***************
  223. *** 1433,1444 ****
  224.               {
  225.   #if YYDEBUG
  226.                   if (yydebug)
  227. !                     printf("yydebug: state %d, error recovery shifting\
  228. !  to state %d\n", *yyssp, yytable[yyn]);
  229.   #endif
  230.                   if (yyssp >= yyss + yystacksize - 1)
  231.                   {
  232. !                     goto yyoverflow;
  233.                   }
  234.                   *++yyssp = yystate = yytable[yyn];
  235.                   *++yyvsp = yylval;
  236. --- 1433,1459 ----
  237.               {
  238.   #if YYDEBUG
  239.                   if (yydebug)
  240. !                     fprintf(stderr,
  241. !              "yydebug: state %d, error recovery shifting to state %d\n",
  242. !              *yyssp, yytable[yyn]);
  243.   #endif
  244.                   if (yyssp >= yyss + yystacksize - 1)
  245.                   {
  246. !             /*
  247. !             ** reallocate and recover.  Note that pointers
  248. !             ** have to be reset, or bad things will happen
  249. !             */
  250. !             int yyps_index = (yyssp - yyss);
  251. !             int yypv_index = (yyvsp - yyvs);
  252. !             yystacksize += YYSTACKSIZE;
  253. !             ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs,
  254. !             yystacksize * sizeof(YYSTYPE));
  255. !             ysave->yyss = yyss = (short*)realloc((char*)yyss,
  256. !             yystacksize * sizeof(short));
  257. !             if (!yyvs || !yyss)
  258. !             goto yyoverflow;
  259. !             yyssp = yyss + yyps_index;
  260. !             yyvsp = yyvs + yypv_index;
  261.                   }
  262.                   *++yyssp = yystate = yytable[yyn];
  263.                   *++yyvsp = yylval;
  264. ***************
  265. *** 1448,1455 ****
  266.               {
  267.   #if YYDEBUG
  268.                   if (yydebug)
  269. !                     printf("yydebug: error recovery discarding state %d\n",
  270. !                             *yyssp);
  271.   #endif
  272.                   if (yyssp <= yyss) goto yyabort;
  273.                   --yyssp;
  274. --- 1463,1471 ----
  275.               {
  276.   #if YYDEBUG
  277.                   if (yydebug)
  278. !                     fprintf(stderr,
  279. !             "yydebug: error recovery discarding state %d\n",
  280. !             *yyssp);
  281.   #endif
  282.                   if (yyssp <= yyss) goto yyabort;
  283.                   --yyssp;
  284. ***************
  285. *** 1466,1473 ****
  286.               yys = 0;
  287.               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  288.               if (!yys) yys = "illegal-symbol";
  289. !             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
  290. !                     yystate, yychar, yys);
  291.           }
  292.   #endif
  293.           yychar = (-1);
  294. --- 1482,1490 ----
  295.               yys = 0;
  296.               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  297.               if (!yys) yys = "illegal-symbol";
  298. !             fprintf(stderr,
  299. !         "yydebug: state %d, error recovery discards token %d (%s)\n",
  300. !         yystate, yychar, yys);
  301.           }
  302.   #endif
  303.           yychar = (-1);
  304. ***************
  305. *** 1476,1482 ****
  306.   yyreduce:
  307.   #if YYDEBUG
  308.       if (yydebug)
  309. !         printf("yydebug: state %d, reducing by rule %d (%s)\n",
  310.                   yystate, yyn, yyrule[yyn]);
  311.   #endif
  312.       yym = yylen[yyn];
  313. --- 1493,1499 ----
  314.   yyreduce:
  315.   #if YYDEBUG
  316.       if (yydebug)
  317. !         fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n",
  318.                   yystate, yyn, yyrule[yyn]);
  319.   #endif
  320.       yym = yylen[yyn];
  321. ***************
  322. *** 2161,2168 ****
  323.       {
  324.   #if YYDEBUG
  325.           if (yydebug)
  326. !             printf("yydebug: after reduction, shifting from state 0 to\
  327. !  state %d\n", YYFINAL);
  328.   #endif
  329.           yystate = YYFINAL;
  330.           *++yyssp = YYFINAL;
  331. --- 2178,2186 ----
  332.       {
  333.   #if YYDEBUG
  334.           if (yydebug)
  335. !             fprintf(stderr,
  336. !         "yydebug: after reduction, shifting from state 0 to state %d\n",
  337. !         YYFINAL);
  338.   #endif
  339.           yystate = YYFINAL;
  340.           *++yyssp = YYFINAL;
  341. ***************
  342. *** 2176,2182 ****
  343.                   yys = 0;
  344.                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  345.                   if (!yys) yys = "illegal-symbol";
  346. !                 printf("yydebug: state %d, reading %d (%s)\n",
  347.                           YYFINAL, yychar, yys);
  348.               }
  349.   #endif
  350. --- 2194,2200 ----
  351.                   yys = 0;
  352.                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  353.                   if (!yys) yys = "illegal-symbol";
  354. !                 fprintf(stderr, "yydebug: state %d, reading %d (%s)\n",
  355.                           YYFINAL, yychar, yys);
  356.               }
  357.   #endif
  358. ***************
  359. *** 2191,2210 ****
  360.           yystate = yydgoto[yym];
  361.   #if YYDEBUG
  362.       if (yydebug)
  363. !         printf("yydebug: after reduction, shifting from state %d \
  364. ! to state %d\n", *yyssp, yystate);
  365.   #endif
  366.       if (yyssp >= yyss + yystacksize - 1)
  367.       {
  368. !         goto yyoverflow;
  369.       }
  370.       *++yyssp = yystate;
  371.       *++yyvsp = yyval;
  372.       goto yyloop;
  373.   yyoverflow:
  374. !     yyerror("yacc stack overflow");
  375.   yyabort:
  376. !     return (1);
  377.   yyaccept:
  378. !     return (0);
  379.   }
  380. --- 2209,2243 ----
  381.           yystate = yydgoto[yym];
  382.   #if YYDEBUG
  383.       if (yydebug)
  384. !         fprintf(stderr,
  385. !         "yydebug: after reduction, shifting from state %d to state %d\n",
  386. !         *yyssp, yystate);
  387.   #endif
  388.       if (yyssp >= yyss + yystacksize - 1)
  389.       {
  390. !     /*
  391. !     ** reallocate and recover.  Note that pointers
  392. !     ** have to be reset, or bad things will happen
  393. !     */
  394. !     int yyps_index = (yyssp - yyss);
  395. !     int yypv_index = (yyvsp - yyvs);
  396. !     yystacksize += YYSTACKSIZE;
  397. !     ysave->yyvs = yyvs =
  398. !         (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
  399. !     ysave->yyss = yyss =
  400. !         (short*)realloc((char*)yyss,yystacksize * sizeof(short));
  401. !     if (!yyvs || !yyss)
  402. !         goto yyoverflow;
  403. !     yyssp = yyss + yyps_index;
  404. !     yyvsp = yyvs + yypv_index;
  405.       }
  406.       *++yyssp = yystate;
  407.       *++yyvsp = yyval;
  408.       goto yyloop;
  409.   yyoverflow:
  410. !     yyerror("Out of memory for yacc stack");
  411.   yyabort:
  412. !     retval = 1;
  413.   yyaccept:
  414. !     return retval;
  415.   }
  416.